home *** CD-ROM | disk | FTP | other *** search
- head 1.13;
- branch ;
- access ;
- symbols ;
- locks ; strict;
- comment @@;
-
-
- 1.13
- date 91.04.11.12.53.26; author kupfer; state Exp;
- branches ;
- next 1.12;
-
- 1.12
- date 91.04.03.21.48.20; author rab; state Exp;
- branches ;
- next 1.11;
-
- 1.11
- date 90.04.13.14.27.46; author douglis; state Exp;
- branches ;
- next 1.10;
-
- 1.10
- date 89.10.09.21.28.03; author rab; state Exp;
- branches ;
- next 1.9;
-
- 1.9
- date 89.08.18.11.21.35; author douglis; state Exp;
- branches ;
- next 1.8;
-
- 1.8
- date 89.08.17.11.15.57; author douglis; state Exp;
- branches ;
- next 1.7;
-
- 1.7
- date 89.04.06.21.40.17; author jhh; state Exp;
- branches ;
- next 1.6;
-
- 1.6
- date 89.01.16.08.23.29; author ouster; state Exp;
- branches ;
- next 1.5;
-
- 1.5
- date 88.12.31.10.43.50; author ouster; state Exp;
- branches ;
- next 1.4;
-
- 1.4
- date 88.12.28.14.45.46; author ouster; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 88.11.13.11.50.19; author ouster; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 88.11.10.15.14.52; author ouster; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 88.11.10.14.00.41; author ouster; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.13
- log
- @Flush DEFTARGET: the default target is now determined by a pmake
- library file.
- @
- text
- @#!/sprite/cmds/csh -f
- #
- # A script to generate (or regenerate) a source (cmds) directory Makefile
- # from a prototype Makefile. If ./Makefile.proto exists, use it, else
- # use a common prototype.
- #
- # We assume we were invoked from mkmf, thus we don't need to alter the
- # path, and MKMFDIR is in the environment to tell us where to find prototype
- # makefiles, etc.
- #
- # Parameters passed in from mkmf as environment variables:
- #
- # DOMACHINES names of machines we are supposed to run mkmf on
- # MKMFDIR directory containing prototype makefiles
- # MKMFFLAGS arguments to all mkmfs run recursively
- # MACHINES list of machine names (e.g. "sun2 sun3"), for
- # which there are machine-dependent subdirectories
- # (sun2.md, sun3.md) to hold the object files and
- # any machine-specific source files to use when
- # compiling for that machine
- # MAKEFILE name of makefile to create
- # SUBTYPE information about what type of command this is:
- # used to figure out where to install things.
- #
- # Several of these environment variables must be copied to local shell
- # variables before use, because shell variables can be used in some places
- # where environment variables can't.
-
- #
- # Argument processing. (Generalized form, even though just one flag so far.)
- #
- while ($#argv >= 1)
- if ("$1" == '-x') then
- set echo
- endif
- shift
- end
-
- set nonomatch
- set srcs =(*.{h,c,s,l,y,cc} *.md/*.{h,c,s,l,y,cc,o})
- set mds = (*.md)
- set manPages = (*.man)
- if ("$mds" == "*.md") then
- set mds = ()
- endif
- if ("$manPages" == "*.man") then
- set manPages = ()
- endif
- #
- # Check to see if there were any sources. The first check (size == 2, the
- # number of strings that would be there if there were no matches)
- # is only necessary because the second check will cause an error if
- # srcs contains more than 1024 bytes. If no sources, then assume that
- # this directory contains only a shell script (and eliminate any
- # machine-dependent subdirectories that Pmake might have created).
- #
- if ($#srcs == 2) then
- if ("$srcs" == "*.{h,c,s,l,y,cc} *.md/*.{h,c,s,l,y,cc,o}") unset srcs
- endif
- unset nonomatch
- if (! $?srcs) then
- echo "No sources, assuming shell script."
- if ("$mds" != "") then
- echo "Deleting extraneous subdirectories $mds."
- rmdir $mds
- if ($status != 0) then
- echo "Error removing directories: not empty."
- exit 1
- endif
- endif
- $MKMFDIR/mkmf.script $*
- exit $status
- endif
-
- set subtype=$SUBTYPE
- set prog=$cwd:t
- set machines=($MACHINES)
- set domachines = ($DOMACHINES)
- set makefile=($MAKEFILE)
- set distdir=($DISTDIR)
-
- if (-e $makefile.proto) then
- set proto=$makefile.proto
- else
- set proto="${MKMFDIR}/Makefile.command"
- endif
-
- echo "Generating $makefile for $prog using $proto"
-
-
- cat $proto | sed \
- -e "s,@@(DATE),`date`,g" \
- -e "s,@@(MACHINES),$machines,g" \
- -e "s,@@(MAKEFILE),$makefile,g" \
- -e "s,@@(MANPAGES),$manPages,g" \
- -e "s,@@(NAME),$prog,g" \
- -e "s,@@(TEMPLATE),$proto,g" \
- -e "s,@@(TYPE),$subtype,g" \
- -e "s,@@(DISTDIR),$distdir,g" \
- > $makefile
-
- setenv PARENTDIR $cwd
- foreach i ($domachines)
- (cd $i.md; mkmf $MKMFFLAGS -f md.mk)
- end
- @
-
-
- 1.12
- log
- @Add C++ support (Mike checking in for Bob).
- @
- text
- @a12 1
- # DEFTARGET name of default target
- a79 1
- set defTarget=($DEFTARGET)
- a92 1
- -e "s,@@(DEFTARGET),${defTarget:q},g" \
- @
-
-
- 1.11
- log
- @only remove subdirectories if empty.
- @
- text
- @d41 1
- a41 1
- set srcs =(*.[hcsly] *.md/*.[hcslyo])
- d59 1
- a59 1
- if ("$srcs" == "*.[hcsly] *.md/*.[hcslyo]") unset srcs
- @
-
-
- 1.10
- log
- @Modifications for distribution.
- @
- text
- @d66 5
- a70 1
- rm -rf $mds
- @
-
-
- 1.9
- log
- @another change for TM -- use single machine if it exists, else \ds3100
- @
- text
- @d78 1
- d98 1
- @
-
-
- 1.8
- log
- @removed DEFTARGET -- we use $MACHINE now
- @
- text
- @d13 1
- d77 1
- d90 1
- @
-
-
- 1.7
- log
- @added abilty to make specific machine types
- @
- text
- @a12 1
- # DEFTARGET name of default target
- a75 1
- set defTarget=($DEFTARGET)
- a87 1
- -e "s,@@(DEFTARGET),$defTarget,g" \
- @
-
-
- 1.6
- log
- @Bug in last change.
- @
- text
- @d12 3
- d75 1
- d77 1
- a86 5
- if (" $machines " =~ *\ sun3\ *) then
- set defTarget=sun3
- else
- set defTarget=$machines[1]
- endif
- d99 2
- a100 1
- foreach i ($machines)
- @
-
-
- 1.5
- log
- @Include ".y" files when deciding whether there are any sources.
- @
- text
- @d38 1
- a38 1
- set srcs =(*.[hcsl] *.md/*.[hcslo])
- @
-
-
- 1.4
- log
- @Change to use TYPE instead of INSTALLMAN and INSTALLDIR.
- @
- text
- @d56 1
- a56 1
- if ("$srcs" == "*.[hcsl] *.md/*.[hcslo]") unset srcs
- @
-
-
- 1.3
- log
- @Change "PROGRAM" to "NAME".
- @
- text
- @a69 25
- switch ($subtype)
- case sprite:
- set installdir=/sprite/cmds
- set installman=/sprite/doc/ref/cmds
- breaksw
- case daemon:
- set installdir=/sprite/daemons
- set installman=/sprite/doc/ref/daemons
- breaksw
- case test:
- set installdir=/sprite/tests
- set installman=/sprite/doc/ref/tests
- breaksw
- case admin:
- set installdir=/sprite/admin
- set installman=/sprite/doc/ref/admin
- breaksw
- case x:
- set installdir=/X/cmds
- set installman=/X/doc/ref/cmds
- breaksw
- default:
- echo Unknown command subtype "$subtype"
- exit 1
- endsw
- a90 2
- -e "s,@@(INSTALLDIR),$installdir,g" \
- -e "s,@@(INSTALLMAN),$installman,g" \
- d95 3
- a97 1
- -e "s,@@(TEMPLATE),$proto,g" > $makefile
- @
-
-
- 1.2
- log
- @Final change for new C library: added man page stuff, etc.
- @
- text
- @d121 1
- a121 1
- -e "s,@@(PROGRAM),$prog,g" \
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @a21 9
- #
- # Variables generated here:
- # subtype subtype of makefile to make (e.g. att, src, local, etc.)
- # prog program to create (directories are assumed to be named
- # after the programs they create)
- # makefile name of the makefile to create
- # proto name of prototype makefile to use to create $makefile
- # machines variable equivalent to MACHINES; needed because env
- # variables can't always be used where variables can.
- d23 3
- d38 9
- a46 1
- set srcs =( *.[hcsl] *.md/*.[hcsl])
- d51 3
- a53 1
- # srcs contains more than 1024 bytes.
- d56 1
- a56 1
- if ("$srcs" == "*.[hcsl] *.md/*.[hcsl]") unset srcs
- d61 4
- a64 3
- # get rid of the default subdirectory mkmf creates when it thinks this is an
- # executable program.
- if (-d sun3.md) rmdir sun3.md
- d73 1
- d77 1
- d81 1
- d85 1
- d89 1
- d97 1
- a97 1
- set makefile=$MAKEFILE
- d102 1
- a102 1
- set proto="${MKMFDIR}/Makefile.command2"
- d114 4
- a117 1
- -e "s,@@(PROGRAM),$prog,g" \
- a118 1
- -e "s,@@(DEFTARGET),$defTarget,g" \
- d120 3
- a122 3
- -e "s,@@(TEMPLATE),$proto,g" \
- -e "s,@@(DATE),`date`,g" \
- -e "s,@@(INSTALLDIR),$installdir,g" > $makefile
- @
-